﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="admin_card_cardAdd" Codebehind="cardAdd.aspx.cs" %>

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">           
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title> </title>
      <link href="../css/skin.css" rel="stylesheet" type="text/css" />
       <script type="text/javascript" src="../js/main.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
     <script language="javascript" type="text/javascript" src="/My97DatePicker/WdatePicker.js"    ></script>
    <script language="javascript" type="text/javascript">
        function checkForm() {

            var cardPrice = document.getElementById("cardprice");
            var endTime = document.getElementById("endtime");
            var lastTime = document.getElementById("lasttime");
            var cardType = document.getElementById('<%=ddlCardType.ClientID %>');
            var cardCount = document.getElementById("txtCardCount");
            var oBeforNumber = document.getElementById("befornumber");
            if (cardPrice.value == "") {
                alert("礼品卡面值不能为空!")
                cardPrice.focus();
                return false;
            } else if (isNaN(cardPrice.value) || cardPrice.value <= 0 || parseFloat(cardPrice.value) % 1 != 0) {
                alert("礼品卡面值必须是大于0的整数!")
                cardPrice.focus();
                return false;
            } else if (isNaN(oBeforNumber.value) || oBeforNumber.value <= 0 || parseFloat(oBeforNumber.value) % 1 != 0) {
                alert("礼品卡前面数字必须是大于0的整数!")
                oBeforNumber.focus();
                return false;
            }

            else if (endTime.value == "") {
                alert("专区截止日期不能为空!");
                endTime.focus();
                return false;
            }
            else if (cardType.value == "") {
                alert("卡片类别不能为空!");
                cardType.focus();
                return false;
            }
            else if (cardCount.value == "") {
                alert("卡片数量不能为空!");
                cardCount.focus();
                return false;
            } else if (isNaN(cardCount.value) || cardCount.value <= 0 || parseFloat(cardCount.value) % 1 != 0) {
                alert("卡片数量必须是大于0的整数!")
                cardCount.focus();
                return false;
            }
        }
    </script>

</head>


<body class="body">

                <div class="maincontent">
                    <form id="form1" runat="server">
                        <table cellpadding="0" cellspacing="0" style="width: 100%">
                           <tr>
              <td class="td_title">礼品卡面值：</td>
              <td class="td_content">
              <input name="cardprice" type="text" id="cardprice"  runat="server" value="0" style="width: 80px" />*即购买人需要花费的实际金额</td>
            </tr>

           <tr>
              <td class="td_title" width="20%">卡起始号</td>
              <td class="td_content"><input name="befornumber" type="text" id="befornumber"  runat="server" 
                      value="" style="width: 120px" maxlength="15" /> <br />
                  </td>
            </tr>
            <tr>
              <td class="td_title">专区开始日期</td>
              <td class="td_content">
              <input id="txtSartTime"  name="txtSartTime" runat="server" type="text" onfocus="new WdatePicker(this,'%Y-%M-%D',true,'default')"  onpaste="return false" style="ime-mode: disabled"  />
    </td>
            </tr>
            <tr>
              <td class="td_title">专区截止日期</td>
              <td class="td_content">
              <input id="endtime"  name="endtime" type="text" runat="server" onfocus="new WdatePicker(this,'%Y-%M-%D',true,'default')"  onpaste="return false" style="ime-mode: disabled"  />
            </td>
            </tr>
             <tr class="td_content">
              <td class="td_title">发行方式</td>
              <td>
               <asp:DropDownList ID="ddlPublishWay" runat="server">
                <asp:ListItem Text="卡券" Value="卡券"></asp:ListItem>
                 <asp:ListItem Text="电子券" Value="电子券"></asp:ListItem>
               </asp:DropDownList>
              </td>
            </tr>
            <tr>
              <td class="td_title">礼品卡类别</td>
              <td class="td_content">
                  <asp:DropDownList ID="ddlCardType" runat="server">
                  </asp:DropDownList>
                </td>
            </tr>
     
             <tr>
              <td class="td_title">数量</td>
              <td class="td_content">
              <input name="txtCardCount" type="text" id="txtCardCount"  runat="server" value="0" style="width: 80px" />
              </td>
            </tr>
            <tr>
              <td class="td_title">&nbsp;</td>
              <td class="td_content">
                 <asp:ImageButton ID="btnGenerate"  OnClientClick="return checkForm();" ImageUrl="../images/btnGenerateCard.gif" runat="server" OnClick="ibtnGenerate_Click" />
                </td>
            </tr>
            </table>
      
  <asp:GridView ID="GridView1" runat="server" Width="100%" CellPadding="4" ForeColor="#333333" 
                  AutoGenerateColumns="False" pagesize="100" BorderStyle="Solid" 
                  BorderWidth="1px" 
      ShowFooter="false" EmptyDataText="没有数据记录！！" >
        <Columns>
           <asp:BoundField HeaderText="卡 号" DataField="cardcode" />
               <asp:BoundField HeaderText="礼品卡类别" DataField="CardTypeName" />
        <asp:BoundField HeaderText="金 额" DataField="cardprice"  />
          <asp:TemplateField HeaderText="专区开始日期">
          <ItemStyle Width="100px" />
        <ItemTemplate>
           <%# string.Format("{0:yyyy-MM-dd}",Eval("starttime"))%>
        </ItemTemplate>
           </asp:TemplateField>
        <asp:TemplateField HeaderText="专区截止日期">
        <ItemStyle Width="100px" />
        <ItemTemplate>
           <%# string.Format("{0:yyyy-MM-dd}",Eval("endtime"))%>
        </ItemTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText="礼品商城截止日期">
        <ItemStyle Width="110px" />
        <ItemTemplate>
           <%# string.Format("{0:yyyy-MM-dd}", Eval("lasttime"))%>
        </ItemTemplate>
        </asp:TemplateField>
       
        </Columns>
             <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />             
             <PagerStyle BackColor="White" ForeColor="#333333" HorizontalAlign="Center" Font-Bold="True" Font-Size=30px />
             <HeaderStyle BackColor="#E2E7EB" Font-Bold="True" ForeColor="Black" HorizontalAlign="Left" />
             <AlternatingRowStyle BackColor="White" />
             <PagerSettings Visible="False" />
        </asp:GridView>
      
  <table width="100%" border="0" cellpadding="5" cellspacing="0">
  <tr>
      <td align="center"  colspan="2" >

                   <asp:ImageButton ID="btnAdd"  Visible="false" ImageUrl="../images/btnGenerateCard.gif" runat="server"  OnClick="ibtnAdd_Click" />

       <asp:ImageButton ID="btnExport"  Visible="false" ImageUrl="../images/btnExportExcel.gif" runat="server" OnClick="ibtnExport_Click" />

     
</td>
      </tr>
  </table>
                    </form>
                </div>
</body>

     </html>


